﻿@model IList<myMvcBlog.Category>
@{
    ViewBag.Title = "Categories";
    Layout = "~/Views/Shared/_AdminLayout.cshtml";
}
<h2>
    Categories</h2>
<table id="postsTable" cellspacing="0">
    <tr>
        <th>
            Actions
        </th>
        <th>
            Title
        </th>
        <th>
            Nice Name
        </th>
        <th>
            Posts
        </th>
    </tr>
    <tbody>
        @foreach (var category in Model)
        {
            <tr>
                <td>
                    @Html.ActionLink("Edit", "EditCategory", new { id = category.ID })
                </td>
                <td>@category.Name
                </td>
                <td>@category.UrlName
                </td>
                <td>
                    @Html.ActionLink(category.PostCategories.Count().ToString(), "PostsByCategory", new { Controller = "Admin", categoryId = category.ID })
                </td>
            </tr>
        }
    </tbody>
</table>
